<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>显示学生提交意见反馈</title>
    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-table.css" rel="stylesheet"/>
    <link href="css/bootstrap-select.min.css" rel="stylesheet"/>
    <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="css/bootstrap-markdown.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous">
    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>



    </style>
</head>
<body>
<!--导航栏开始-->
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">预热班学员管理系统—学生意见查看</a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="/rsm/showallstudent.html">返回</a></li>
                    <li></li>
                </ul>
            </ul>
        </div>

    </div>
</nav>
<!--导航栏结束-->

<div class="container-fluid" align="center">

    <table id="mytable" data-toggle="table" data-url="/rsm/suggest/showSuggests.do">
        <thead>
        <tr>
        </tr>
        </thead>
    </table>
    <!--table工具栏开始-->
    <div id="toolbar">
        <div class="btn-group">
            <a class='input-group date' id='datetimepicker1' style="float: left; left: 10px;">
                <input type='text' class="form-control" id='nowdate' style="width: 150px; height: 30px;" />
                <span class="input-group-addon" style="float: left; width: 50px; height: 30px;">
                    <span class="glyphicon glyphicon-calendar" onclick="Datetime()"></span>
                </span>
                <span class="input-group-addon" style="float: left; width: 50px; height: 30px;">
                    <span class="glyphicon glyphicon-search" onclick="refreshTable()"></span>
                </span>
            </a>
        </div>
    </div>
    <!--table工具栏结束-->
        <!--<h1 class="form-signin-heading">当前显示<span id="answerDate"></span>的答案</h1>-->
        <!--<br>-->
        <!--<div id="ti"></div>-->

</div> <!-- /container -->

<!-- jQuery Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边 -->
<script src="js/jquery-3.3.1.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-table.js"></script>
<script src="js/bootstrap-table-zh-CN.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap-markdown.js"></script>
<script src="js/bootstrap-datetimepicker.min.js"></script>
<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="locale/bootstrap-markdown.zh.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
    $("#mytable").bootstrapTable({
        method:'post',
        //显示搜索框
        search: true,
        //显示刷新按钮
        showRefresh:true,
        //显示切换视图（table/card）按钮
        showToggle:true,
        //是否显示内容列下拉框。
        showColumns:true,
        //设置为 true 会有隔行变色效果
        striped:true,
        //设置为 true 会在表格底部显示分页条
        pagination:true,
        pageSize: 50,
        pageList: [50,100], //可供选择的每页的行数（*）
        //是否显示列头showHeader:false
        showHeader:true,
        editable:true,
        //自定义工具栏
        toolbar:"#toolbar",
        toolbarAlign:'left',
        columns :[{
            field : 'checked',
            checkbox : true,
        },{
            title: '序号',
            field: '',
            align: 'center',
            formatter: function (value, row, index) {
                return index+1;
            }
        }, {
                field : 'text',
                title : '意见内容'
            },{
                field : 'xsname',
                title : '学生'
            }
        ]
    });
    //设置日期时间控件
    function Datetime() {
        $('#datetimepicker1').datetimepicker({
            language: 'zh-CN',//显示中文
            format: 'yyyy-mm-dd',//显示格式
            minView: "month",//设置只显示到月份
            initialDate: new Date(),
            autoclose: true,//选中自动关闭
            todayBtn: true,//显示今日按钮
            
        });
        //默认获取当前日期
        var today = new Date();
        var nowdate = (today.getFullYear()) + "-" + (today.getMonth() + 1) + "-" + today.getDate();
        //对日期格式进行处理
        var date = new Date(nowdate);
        var mon = date.getMonth() + 1;
        var day = date.getDate();
        var mydate = date.getFullYear() + "-" + (mon < 10 ? "0" + mon : mon) + "-" + (day < 10 ? "0" + day : day);
        document.getElementById("nowdate").value = mydate;

        //发送请求重新获取答案信息  需要发送日期信息 格式yyyy-mm-dd
        //重置table请求url 刷新

    }
    function refreshTable() {
        var mydate = document.getElementById("nowdate").value;
        var opt = {
            url: "/rsm/suggest/showSuggests.do?suggestDate="+mydate,
//            silent: true, //静默刷新
//            query:{
//                //请求参数
//                answerDate1:mydate
//            }
        };
        $("#mytable").bootstrapTable('refresh',opt);
    }
    $(function() {

//        $.ajax({
//            url: '/rsm/answer/showAnswers.do',
//            async: true,
//            type: "get",
//            dataType:'json',
//            success: function (data) {
//                var html = "";
//                var answerDate = "";
//                for(var i=0;i<data.length;i++){
//                    var answerName = data[i].answerName;
//                    var subjectText = data[i].subjectText;
//                    var answerText = data[i].answerText;
//                    answerDate = data[i].answerDate;
//                    subjectText = "<h3>"+subjectText+ "</h3><br/>";
//
//                    answerName = "<p><b>"+answerName+ "</b></p>";
//                    html += subjectText;
//                    html += answerText;
//                    html += answerName;
//                    html += "<hr/>";
//                }
//
//                $("#answerDate").html(answerDate);
//                $("#ti").html(html);
//            }
//        });

    });


</script>
</body>
</html>
